package com.example.administrator.printoutindemo;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ProjectInfo implements Serializable {

	private String _proid;
	private String _projectname;

	// 将JSON对象转化为list
	public List<ProjectInfo> getListFromJSON(String JsonStr) {
		List<ProjectInfo> clist = new ArrayList<ProjectInfo>();

		try {

			JSONArray jay = new JSONArray(JsonStr);// 将字符串转化为JSON数组

			for (int i = 0; i < jay.length(); i++) {
				JSONObject temp = (JSONObject) jay.get(i);

				ProjectInfo n = new ProjectInfo();

				n.set_proid(temp.getString("proid"));
				n.set_projectname(temp.getString("projectname"));

				clist.add(n);

			}

		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return clist;

	}

	public String get_proid() {
		return _proid;
	}

	public void set_proid(String _proid) {
		this._proid = _proid;
	}

	public String get_projectname() {
		return _projectname;
	}

	public void set_projectname(String _projectname) {
		this._projectname = _projectname;
	}

}